optimize the motion and the size