some cleanup to reduce memory footprint