RLE code works, but still messy and untested.