swapped some logic