some refactoring and a new logs feature