Remove vars by replacing iteration with recursion in my Problem 9 Solution