Refactor log
wip