Refactor as per review.