got rid of multiple log entries + refactoring.