Refactor the index and abstract out to specific files