Improved type management