A rule optimizer