Rework type reconstruction algorithm.