Performance improvements

Removed some dead code, refactored so we run through the changeset list
as few times as possible