rating refactor