update timer code per suggestions from @mantoni, pull request #437