cleaning up custom_type code