Moved stuff around, added modular multiplicative inverse