Algorithm change for #60