better line breaking algorithm