Added an implementation of efficient exponentiation