moderate refactoring