Reorganize and add more rules.