First worked version (need debug and refactoring)
Refactored version with handle some exceptions
Some code clean