added scopes and refactored code
Merge remote-tracking branch 'origin/master'