Refactor timers

Instead of using system.timers.timer, use a counter for the secondary
timer.