Some more refactorings, bringing these closer together.
Sped up the encoder again. Now the biggest time sink is the BitBucket
stuff.