Implemented and partially tested gcd