Generating boolean ops and if statements