file state: refactor to avoid shadowing comment() func; optimization too