This pull request applies the instanceof pattern matching across the codebase. This enhancement will improve code readability.

Comment From: scottfrederick

Thanks for the contribution @FelixDes.