fmt changes and new test for writing index to file