Finished refactoring but seeing memory leak issues again.