add weighting flag
merge chayanits changes