Changed the displacement calculation