metadata and cleanup