Removes unnecessary cases.