Merge pull request #16 from xiaoqin2012/master

merge from xiaoqin
Add weight selection
Merge pull request #39 from piaw/master

add weight selection