Improved Type.toString()
Added proper error reporting, added tests