More careful metadata handling.
More generic metadata and filename handling.