Reverting code to state from September 22

I checked in code to fix issue #58, an apparent memory leak, but this
code wasn't good. The material gets killed too harshly. We have to solve
the leak in another way.