SWAP finish writing - to be debugged
merge