Updated SynonymReplaceFunction to workable version