Get metadata and cleanup