rewritten resource management