cleaned up readMetadataFile