Took more than an hour to realise that the changes I made in the commit adding deferred completion support were corrupting the completion iterator, thus causing the wrong completions to get fired. Fixed now. Currently dies on another assert, but that's for tomorrow.

Also added lots of debugging facilities.