Resource index: initial refactoring work in progress.