old AVX code from RJH probably now superseded by Kevin's