move set_function to router