minor code modifications
added segment tree with lazy propagation