Changed order of photon output + small bug fix in output