to make detour function