took out a few memory leaks