added findBestShift fn