with tock loop

setTimeout is taken out of tick and placed in the tock function.