WIP: optimize swaps