added the logic to the ranking model