WIP fixes for some line handling oddities, untested until later