Changes to support stripping newlines as well as whitespace.