add threadeded version of avoid