Improved queue swaping, should now have correct semantics.