Refactored to make reduction plugable