I could not think of a good reason why I separated these, and it takes less time if they are in the same loop, so I merged them together