Updated messaging code

Hopefully resolves issue #81 but we'll let @dfoll test it and close.