Fixed documentation and added better disconnect handling