some refactoring + tiny optimization
Merge pull request #31 from AlexandreBeaulne/refactoring

some refactoring + tiny optimization