Many little adjustment & bugfixes
Merge pull request #957 from stloyd/resource-refactoring-2

Many little adjustment & bugfixes