Fixed bugs in P2P metric. Needs cleaning up