Various refactoring to accommodate outbound messages.