Wrote function in max2 to get output from max1