Technology is disclosed for measuring distances. A measurement device emits a beam that reflects on the surface of an object. The measurement device determines the distance to the object, based on the time of flight of the beam from transmission to capture by the measurement device. The measurement device derives feedback reference pulses from pulses in the emitted beam and injects them into the device's receive path—creating a receive waveform that includes one or more feedback reference pulses and corresponding pulses in the return beam. The device uses the pulses in the waveform to measure time of flight. The measurement device can attenuate the feedback reference pulses to intensities similar or equal to the intensities of the return pulses. The measurement device can include a histogram processor that collects waveform samples at varying comparison thresholds. The device employs the most accurate information at each threshold to create a digitized composite waveform that corresponds to the analog waveform received by the measurement device. In some instances the measurement device can process the digitized waveform—removing noise, scaling reference pulses, and removing distortions caused by pulse trailing edges running into subsequent pulses.