Exponent + Modulus Problems

Corrects errors with calculating the exponent, and inefficiencies with
calculating the modulus.