big refactor
Merge pull request #194 from marsqing/master

big refactor