refactor a little and fixes wrong wikidata_ref