third if and else statement added