Improve P2P handling