timer aliasing and some refactoring