changed isP2P function to synchronous