added a ton of comments and setup remove socket in sockets list upon disconnect