Refactor resource fetching