Use defaultdict and move completed tasks to dedicated section