Decoupling logic in chat component