made a separate thread for the timer to run