Factor out init_scan_tables(), patch by Andreas Öman %andreas A olebyn.nu%