Swapped conditions of the changed if statements