sorting out pagebreaks