resource management almost finished.