refactor the log