added docReady to index, error handling to peer.js instances