Creation of min function.