Added scope functions and tests