bugfixing and refactoring to use wikidata