Refactoring destroy functions.