Add max2 fuction.