Revert "first pass refactor"

This reverts commit f662d66ed0ef00db7d9212d7072e28fb8e0d078c.
Merge branch 'master' into teddy/refactoring