Removed fo:flow hackery. Simplified structure checking and page layout loop. Some minor cosmetic changes.