Reorganize random forest example.

I didn't like the way the code read, so I reorganized it so the
interesting bits were in the right order.