Rewrite of RLE writer