fixed division to do repeated multiplications instead of repeated subtractions. Added modulus operation