Cleaned up the messaging code somewhat.

Blocks sure do make some things easier and the code less tangled.