added fenwick tree codes