Make some of the new PDF code a little more efficient