Merge pull request #10 from samzhao88/develop

Support JSON and XML
pull out core engin from the query method
merge with sam version
Merge pull request #11 from HaoranHuang/develop

Merged with sam's version
clean up files and add comments