Made column swap logic more concise