some rewriting