added comments
Fix reconnect issues
Removed unused warnings