Tasks cleanup
Replace all tasks that are not part of the main computation to a threadpool
which can more simply and efficiently schedule small tasks with no dependencies. See #166 (closed).
Peter, can you check that this effectively passes all your tests? Thanks!