First pass refactoring