added modified run length encoding