added some code to connect