added the beginnings of protocol connection handling