improved timer thread