Under IRS Code Section 1017, the reduction of tax attributes due to discharge of indebtedness follows a specific ordering rule. The rules state that the debtor first applies the discharge to debt that is subject to recapture of prior losses, such as Section 1231 gains or losses. Next, the debtor applies the discharge to debt that is not subject to recapture, such as nonrecourse debt. Lastly, the debtor applies the discharge to debt that is not specifically identified, but this application is limited to the amount of the discharge that exceeds the total amount applied to recapture debt and nonrecourse debt.