Adds max and min functions