Refactored types in preparation for custom type system