moved fn in nd_local_maxima