Some minor cleanup; reintroduced variable i that I foolished removed earlier.