optimize bb_types