Remove duplicate if statement