cache variables for looping