Fixing extra if statement