Got writing to file to work