Adding unit tests + cleaning code
Merge branch 'UStests'