Reworked type resolve.