a little rewrite