rewrite prog