fix word space
rewrite the line merging code, to ease future optimizations