refactor due to code review