Add unit tests and more robust replacement logic
Merge branch 'anurse/1381-curatedfeedsbroken' into qa