Rewrite and pass tests