refactor,add unit test.
Merge pull request #62 from forumbyr/master

refactor,add unit test.