Changed `.getClass` to more idiomatic `type`