update white space trimming and squeeze immediate spaces