Changed modular integers to a macro-based system.