added sort by date function