Refactor selecting resources.