First refactor in rules page