gone back to 2 for loops