lots of stuff
de-dup chapter sort code