refactor after code review