Add unit test for timers
Tidy up timer code
Tidy up tests
Port prepare/idle/check to new format