Correct counts
Output new file
Shorten loops