Completed implementation RLE encoding