added smart pointer usage for Segment class.