update the movement logic