Log refactor