pull all DOM lookups out of for loops