move destroying-code into a separate module