added basic segment tree implementation