Rework of integration order calculation. Add some inlining.