* Various CS fix and better exception handling
Merge pull request #30 from jayzeng/refactor/cleanup

* Various CS fix and better exception handling