Partial implementation of P2P code.