dropped for loop in exchange with recursive function looping