make gcd function simpler