Newbee, the code works, almost!

UKHeliBob:
A common mistake is to use int as your "standard" data type only to have the program fail when the value stored is greater than 32767, often as the result of a calculation.

Or using it for timing with millis: "My program runs fine, but only for about thirty seconds"

Thanks UKHeliBob, duly noted for the future, and code updated.

Cheers

M.