Finished the integration function.