got set_types_db function running properly.  ifs should be replaced by case statement.