cleanup code and export pulseInLong function