Connect\disconnect logic fixed, some minor canonization