refactoring after code review