I'm writing companion notes for some beamer presentations. For each slide in a presentation, the document has a small picture of the slide, along with a text explaining the slide. For some slides, the text will be long, while for others, it may be just a sentence or no text at all.
I'd like the layout to be something like this:

Each slide is inside a wrapfigure environment. The problem I have is that, when there is not enough text to wrap around the slide, the slide and the next one will overlap. I tried putting every slide+text into a minipage, but this doesn't solve the problem.
For an example, see page 2 of this document. The code is in https://gist.github.com/830055
How can I avoid floating figures to overlap, so each slide appears in the right place?
Can you think of a better way to create a layout like this one?