work on rewrite