added more support for arbitrary number of dimensions