Powmod for the win