add multidimensional function