added simple resource managment