refactor based on code review