added more error handling
better workflow, now process does not exit before file is saved
changed default log level to error