Improved type recognition