Fixed sample code. Added some documentation on metadata.