Helpers added: gcd calculator, check if e is valid, check if d is valid.