light refactoring on loops/functional sections