refactor Rules class