remove the matrix and use ary of ptr to vectors