final update.  still many memory leaks