uct_search(): Move some variable declarations inside the loop