refactoring deleteObjects