Further code cleanup

Remove awkward use of case for handling / in fractions.

Reorder functions for step-down rule.

Still a lot of awkward lambda usage that needs cleaning.