added logic to handle players leaving the room