added and regrouped tests, renamed some methods, abstracted sum of weights