Changed modulus functions, added tests, adapted