Added a lot of connection stuff to client side.