optimizer rules are now kept in a sorted map

rules can optionally be disabled at runtime