refactor index file