added resource managment