how to rewrite and replicate accounting?