More refactoring, and implement a stub index file