Started performance refactoring

Extracted filter_changesets() into a non-class-level function so it's easier to extract out the changesets.

Extracted out the denominator changesets to a variable and shared it with the numerator changesets.

I haven't benchmarked it yet.