ifThenElse impl