Refactored code by removing favorite path and set rating if fav is true