partly rewrite