Added sort by date functionality