move process out of loop