Merge pull request #28 from eric-wu/master

Optimization, refactoring