DEVIDM: Somewhat improved resource management.
Merge pull request #99 from tomma/master

DEVIDM: Somewhat improved resource management.