Added timed_run function.