[IM] Tidy up some of the P2P stuff.

This is still by no means perfect and still represents a quickish hack to get the functionality live.

It will be redone when we create the next iteration of P2P graphs.