P2POEM: Function Optimization in P2P Networks