3D displacements & motion correction refactoring