Various minor changes.

Add two destructors to fix memory leaks.