Remove block in favour of for loop to reduce temporary object allocation during variable context resolution