still working on outputting to file, not working