change gcd function