memory usage refactoring