put establishConnection in a function in an attempt to reconnect in place