split some code in Run into functs