Improved type and namespace lookup