Rearranged and generalized code in the `Fraction` class a bit.