implementing remove all function2