Adding rule merging and basic test.