parameterize index type
some updates
a mpi-like version