Fixed some bugs, refactored code to use new weight method, updated tests