lots of rewriting