Improved white space trimming