aded some code for control resourses