Use Type method for the switch instead of type assertion.

Also remove the now obsolete utils.isEqual function.