Finish test rewrite