optional weighting complete, needs testing
Merge branches 'optional_weight' and 'master'