code refactoring.
PB-661 #comment code refactoring.
PB-694 #comment fix tests.
PB-661 #comment XML refactoring & clean-up