added validation and the segment field