Added MetadataHandler. Some fixes