Altered the integrating functions 2b more general