Rewrite the run function