finished the code, but it's basically broken. Need to investigate what is going wrong with the weights here. Currently, all arrays get assigned to the same vector...boo...