Encapsulated MetaData members. Added helper functions for common tasks.

Consider splitting this into 4 separate test cases. This will make it easier to debug if only one of them fails.