Replaced __class__ calls with type calls

Just a minor refactor.