Fix the ordering of rules.
Added rules to the test cases.