optimized grounding for fraction rules. Code got way uglier though.