Rewrote the RLE encoder again. Seems pretty good now! Tests are passing so far.