I don't see a way to replace doChan() with doChan(), the way I will sortData(),
What do you see as preventing you from doing this?
I see a few pin or channel numbers that differ, but either another table or some arithmetic will sort that out.
It doesn't look to me like memory will be an issue.