wip refactoring resource managment