factor out peerid gen