refactored type system not to rely on objects anymore