Added code to print to a log file (currently commented out)