rewrite entirely