Removing unneeded code when indexing a document