Added type code checking.