use thread instead of timer