Handling IfThenElse statements