Cleared up memory leaks.
Code cleanup.