pull this outside the loop ?