Cleanup, fixed memory leaks