refactor into a few functions (part 1)

So that we can see what we're doing when we optimise
ignore .pyc
Read CSV as a stream, not all at once