end of findBestShift