Add and generate RangeRule; Refactoring