Added a new type system

It needs to be integrated (and cleaned up) + small fixes are needed