working nd_maxima