fixed power calls with modulus + minor changes