Moved modular index functions to its own module