Improved stripWhitespace()