added sorting for index page