Use three functions to hopefully make eaxmple easier to grasp.

I'd like to get people's opinions on this.  I had a sense that the example could be made easier to understand if we split it out into three functions.  I think this way it's easier to see the dependencies between the parts.  It might not be the best separation of concerns here.  Feel free to disagree.  :-)

If we agree we want this, I can go ahead and make the same changes to the new mnist_conv example.