creation of function min