Refactor XBRL converter and add tests