Bugfixes and added mod_exp