separate greatest common divisor code
minor fix