Currently, sidebar.lua is responsible for message processing, server calls, UI presentation, etc. I think this component is probably doing too much, and makes the code difficult to reason about IMO. I think it should be factored out into different modules.