Updated to register the function call