refactoring per code review