Added flexible tick sleep.