dopaging refactoring, allowing easier customization