replacing thread.sleep with timeutil