seperated into two for loops