Changed Condition to IfThen and IfThenElse