creates a destroy method for this object