use a registry for keeping track of custom types, get rid of null conversion, unnecessary method call