Modify to do true modular exponentiation -- drastically reduces runtime