Build min with average function added