Using If Else to conduct a Function