Basic rewriting. Still need to implement guarded addresses.