added extensive comment to, and fixed bug in, getPeers