Improved type and error formatting