Added sortByDate functionality