code to clean up custom data structures