Add metadata support. Patch by Michael Karcher.