inlined the min and total calculation. but almost no time gain.