Move pool outside the loop