more changes and additions to the rewrite