first pass refactor (#1)