remove unnecessary for loops