refactor to use scope