first refactor