Finished the initial data transfer handshake code.