working on memory leaks