added reading of Metadata and its streams

refactoring

fixed errors