some code clean up in indexfile