fixed modulus and other steps for exercise 2