major refactor simplifying client architecture

tests don't pass yet
tests compile, don't pass