some code refactoring, docs