swap logic tweak