Modified run-length encode