minor changes made in the if statement