Moved timed loop code into timeLoop file