Small refactor to pull the for loop into the right position.