Begin refactoring type system