Develop

Code refactoring and fix issue #4