fold second loop into the first