remove dependence
simplify code and add comments
Merge pull request #2 from yixuan/master

minor modification