removing memory leaks