Revert "Unfinished new rules engine"

This reverts commit 9a1b04466cadd6d8fdbbc3bbc73f4c1c7edc7c9e.