second refactor