@edwlook do we actually need the extra if statement here? Can't we always perform the replacement?