Merge pull request #6 from xspider/master

sync master
Merge pull request #7 from xspider/master

sync master
add test cases
Merge pull request #8 from xspider/master

sync master
Merge pull request #17 from miller/master

add test case