completed loop recursion