added whitespace replacement functionality