added ndarray option