Refactored to used the Fraction class in a number of places rather than explicitly specifying the numerator and denominator.