Resources management improvements

Previous work/info in #162.