File writing and bug fixes

v0.1.1