added modular power function