refactored calculation of bit pulses