function added; if else statement added