Refactor ResourcePools.
Improve clearUnused.
Merge branch 'sepples11'