Fixed XA test
Cleanup
Refactorings and code quality improvements
Refactorings
Added scope tests
Code improvements
Added refactored tests