implement use of for loop where possible