added docstring and comments for gcd