Refactor as per code review.