Convenience method of this method working for a number of dimensions up to 4.