Added a minimum function.