Fix bug: Switch new flag list generation to use flag and flag_types tables instead.