Session cleanup.
Transform trivial switch-statements to objects. Move removeOldChatMessage right below addChatMessage, since it is only used there.