Min function added