Code reorganisation for UTF-Friendly Trims