remove duplicate if statement