some refactoring.
Merge pull request #7 from mhshams/bug

some refactoring.