rework network code to photon