Fraction

This whole function could easily be made smaller, more idiomatic, and easier to read. Tomorrow, perhaps.