Use ndarray instead of multidimensional arrays