Fixing and documenting our swap.js.