LoL: [style] move some code out of loop