updated removeall with recursion