new version, imporoved integration routine