changed metadata type to use Map, minor cleanup