Reorganize main to index