Remove unused code that could cause leaks