review and refactor