finding the minimum of two values