Organize tasks by date.
Refactored sort by date code

Used closure instead of embedded function.