updated the 3D-speedfunction