finished backend for rating