Refactor based on code review