Implemented distance attenuation.