Refacotred logging