first pass of major refactor
finish initial refactor