Added connection threading