added resource handling