Final logger and some refactoring