Implemented writing results to a text file, rather than the console
window.