Implemented feature to output to file.