Koszul cohomology and singular curves