Nice example code Steve!

You can shave off a tiny bit more by changing:

IF amountofpulsout > 0 THEN


To:

IF amountofpulsout THEN

Since when you're just checking if the variable is any value more than 0, if it is more than 0, the IF...THEN will return true.

Arch