Flatten peers data structure and update peers.js