refactor index, type to have resource ancestor