properly handle multidimensional arrays of input coordinates