cleaned up code for Intermediate Representation