refactor by using scope
remove debugger