Essays In Macroeconomics With Heterogeneity