Moved post-completion handler into separate function.

This makes it easier to debug with edebug.

Also fixed a small typo.