First cut. Seems to work on most of the statements I have, but there's a few glitches depending on how page breaks fall that still need fixing