Cleaning up containing element references