refactoried the code
Merge pull request #12 from bcho/develop

fixed #10