Simplify the code for the session-specific accumulation of messages