Updated to allow logging to files.