Improve line-length calculation