Sort task lists appropriately. Fixes #4.

Pending tasks are now sorted with the earliest deadlines first, while
completed tasks are sorted with the earliest completion date first.