Fixed issues with destroy being called twice with the same id.
Fix issue with locking causing warnings
Refactor swap