Added sort-by functionality.