Replacement function works