Use preferred API for metadata.

Implements suggestion by Ashraf Barakat. Thanks!
Fix second argument to transform() - id, not URI.

Thanks to Ashraf Barakat for the review.
Add TODO items for two remaining issues identified by Ashraf