Refactor resources selecting.
Refactor resources selecting.