Code refactoring
Merge pull request #520 from sami1971/xlabs2

Code refactoring