refactoring of delete all