renamed 'save' to 'write'