yet another rewrite