Modify syncing code to support multiple peers.

Previously the code was only designed to work with a single peer.  This
commit modifies the syncing code to deal with multiple peers.