added finite photons, simpler impl [ci skip]