tries to get rid of the memory leaks