Add partition logic to parse rules, and tweak 2 handlers to use it