code from 6/27/2014
Merge branch 'master' of https://github.com/YuqianJiang/bwi_experimental