Refactor as per code review suggestions.