Added run-length encoding