Refactoring for ease of customization.