add unittest for timer
 .
 .
 .
 add comments
 .
 use closure
 .
fixbug in unittest
 .