Updated for readonly arg to writeSwap