Struggling with algorithm of most popular items!