improvements to appending (wip)

I've got appending working to the point where the file isn't blank
afterwords. However, appending still overwrites the files contents,
so this is a work in progress.