gcd implimentation