Merge pull request #14 from hxu/extract

extract refactor done
this fixes #20