Removing code duplication in pool_manager.rb