Add efficient squaring to exponentiation