Add swap implementation and fix copy