I don't really understand why or what we're looping through here.

We also set the count and keep looping, so its the last count that is set that gets returned, is this intended?