various refactoring