Major fixes -- and probably breakages -- for the messages module