First pass refactor.