Moves type related code into type objects