this version allows the user to print both to the console as well as to a file.
Merge remote-tracking branch 'origin/master'