rewrite append