Essays on the design and analysis of markets