This line feels like a hack. It also doesn't preserve comments. Is there any way to get the contents of the indices without losing comments?