Simplifying fractions code slightly