Some improvements to compiler