Closes #641 (closed)
I did not refactor the region finding code into a separate function, because I didn't want to touch the segmentation code at all. Since the code is basically two lines, it's not all that bad. I did put it in its own function in merger.py, so we can move it elsewhere and call it from both places if we want.
There was also a bug in merging lines with non-null line types. It just didn't work, I'm not sure how nobody noticed this before.