first pass of re-factoring