implemented for loops