Refactored Chat component.