refactor groupchats