added code to parse RLE patterns, still need to debug