Complete first refactor