pulled connection stuff out of viewcontroller