Give PromiseWrapper a `then` method
Cleanup in Loader.ts

Some dead code-removal, some reordering of functions.
Delay committing Loader updates until the right point in the event loop

This introduces a bit of added complexity, but amazingly only a net 4 new lines of code.