Added the option to sort by date, both ascending and descending.