small redesign in code and bugfix in JS-importer-hack.