Changed the GCD algorithm to use Rust's pattern matching