Cleaned up some memory leaks