fix typo
refactoring, rename methods, improve logging