Essays on macroeconomics and financial intermediation