Weighter implementation & test.
Weighting rules implementation & test.