rewrite tests as well