Performance improvements (no tmp files) and less "jumpy" behavior.

See the commit messages for details.

These changes should make saving a little quicker (and less exhausting).

Upon cursory examination the formatting and errors both work. Might need a second set of eyes though. Super tired as I write this... hope you like it!