More code cleanup, made a timer for run()