Improve resource management