Reafctoring of ChatRoom.scala