Some code cleaning and some tests
Merge pull request #1 from xseignard/master

Some code cleaning and some tests