generalized to functions, finished integrations