added vector, tweaked fenwick