Made memory usage more effective