Deduplicate lines

One half (arguably the more difficult one) of #29