returned to using trapz