refactoring resource pool, making it possible to plug in custom implementation