refactoring according to review