changed from 3D to nD