Fixed #887: refactored to make use of stripWhitespace