Move and rename to prepareWrite.js