separate metadata middleware