Change uint for lengths to size_t.

This requires converting them back to uint for MPI calls only.
Remove some explicit x,y,z and fix some z,y,x.
Add comments.