small addons and refactoring