Math module refactoring.