Greatly improved rule lookup