Uses isinstance method to be more cohesive

A simple pull request just to follow @vandersonmota decison at the commit 982e1c97470de62b312a411b94a887530d5199c2.