Issue #3: Refactor message processing to cover all bases. Missing: clearing session messages