finished implementing ``simplify_lines``