Switched to isinstance from type