added resource cleanup