Essays In Macroeconomics: Monitoring In Debt Contracts And The Distributional Implications Of Automation