Added log file functionality