improved section detection