added logic for saving rating to local storage