The dissertation investigates the optimal structure of corporate debt within a dynamic arbitrage free pricing model. The optimal debt maturity is examined in a setting that allows for dynamic borrowing. The optimality of financing with senior short term and junior long term debt is investigated. Special focus is placed on the role of loan commitments as mechanisms for preventing costly default of firms in financial but not economic distress.