refactored generic mod