Writing to files correctly, UI work and more test cases needed