Refactored the type system to make it more configurable.