Replaced copyfunc with modify_function