added tests for scope methods
refactoring code for metadata features