(a) The terms of a trust shall be construed to achieve the settlor's tax objectives.
(b) On petition by a trustee, settlor, or beneficiary, a court may modify the terms of an irrevocable trust to achieve the settlor's tax objectives in a manner that does not violate the settlor's probable intent. The court may order that the modification operate retroactively.