now writes index file