Added type info class
Added tests
Rewritten everything