added sorting on the main page