find detour function