Refacotring cxn mgt