Refactor of logger