added MIN and MAX util functions