Clearing up memory leaks and stuff.