Finished custom gcd function (extended euclidean algorithm). Finds x and y while
also computing the gcd