Added figures and changed segment_lines to allow for figure creation