Refactor as per review suggestions.