implement the function replacement