Removed memory leaks