removed unnecessary code from if statement