Trivial loop optimizations
PULSEIN function