class TypeFactory is now working correctly