Changed how the state of a task is determined.
Continuations used at the top-level now work when sourcing a file.