add connect and disconnect functionality