Writing index to file now