Refactored code for custom types
Moved class specific functions into their own files
Eliminated duplicate code