Initial implementation of re-write