Moved the replace function into the helper header

Change-Id: I36f3faa73af3bcec55fdbe0bf71cbbe5977870a0