Merge pull request #243 from fabienrohrer/master

Improved code