Added end cases for GCD.