Moduli spaces of unstable curves