refactor using scope