adding gcd test and fixing return