Cleanup, bug squashing, added WriteFile