Added code to detect joining and creating a room