first pass rewriting vis, misc cleanups