refactor slightly to add chat UI class