signficant sizing and flow refactor