Added sort-by functionality