Last week’s season finale of The Knick saw the cocaine-addicted Dr. John Thackery try to solve the mystery of blood types before another doctor could do it. I won’t spoil what happened for you here, but the episode did make me wonder: How are blood types determined these days?

First, some basics about your blood. There are 4 to 6 liters of it in the average adult body, and all blood is made of the same essential elements: Red blood cells, which, using a protein called hemoglobin, transport oxygen and remove carbon dioxide; white blood cells, which fight infection; platelets, which help blood clot; and plasma, which contains salts and proteins and is the fluid that transports the other components.

But though all blood is made of essentially the same stuff, there are some differences—which caused problems for patients receiving blood transfusions before 1901, when Austrian Karl Landsteiner discovered human blood groups (this earned him the Nobel Prize in 1930). According to the Nobel Prize website, mixing two different blood types “can lead to blood clumping or agglutination. The clumped red cells can crack and cause toxic reactions.” The problem is the immune system. Most blood contains antigens, which are substances that make the body produce antibodies. Usually antibodies are for things like viruses and bacteria, but in a wrong transfusion the immune system sees the new blood as an intruder that must be destroyed. Which can prove fatal.

Two blood group systems are important for transfusions, and Landsteiner was involved in the discovery of both. In the ABO Grouping System, there are four types of blood: Type A, Type B, Type AB, and Type O, which are determined by the presence or absence of certain antigens on the surface of red blood cells. According to the American Red Cross,

Group A – has only the A antigen on red cells (and B antibody in the plasma)
Group B – has only the B antigen on red cells (and A antibody in the plasma)
Group AB – has both A and B antigens on red cells (but neither A nor B antibody in the plasma)
Group O – has neither A nor B antigens on red cells (but both A and B antibody are in the plasma)

Immune systems are adapted to individual blood types. If someone from Group B donated blood to someone from Group A, the B antibodies would recognize the B antigen as a threat and blood clumping would occur. But if someone from Group B donated to someone in Group AB there are no B antibodies, so the immune system doesn’t recognize the intruder.

Additionally, there’s the Rh factor blood grouping system. The Rh antigen is either present (+) or absent (-) in the blood. Typically, Rh negative blood goes to patients without the antigen, and Rh positive blood goes to patients who have the antigen—but an Rh positive patient can receive Rh negative blood without any problems.

So there are eight blood groups you can belong to: A Rh+, A Rh-, B Rh+, B Rh-, AB Rh+, AB Rh-, O Rh+, and O Rh -, although doctors usually leave out the Rh and just say + or -. What blood type a person ends up with is determined by genetics.

To figure out a person’s blood type, doctors can use two methods: ABO Typing or back typing. In ABO typing, doctors take blood and mix it with serums containing the antibodies in Type A and B blood. According to the National Institutes of Health,

If your blood cells stick together when mixed with:

Anti-A serum, you have type A blood
Anti-B serum, you have type B blood
Both anti-A and anti-B serums, you have type AB blood
If your blood cells do not stick together when anti-A and anti-B are added, you have type O blood.

In back testing, known A and B cells are added to samples. If the blood clumps together only when B cells are added, the donor has type A blood. If the blood clumps together when A cells are added, the donor is Type B. And if the blood clumps when either type of cell is added, the donor has Type O blood. No clumping indicates Type AB.

Rh is determined by mixing in anti-Rh serum. If the blood cells stick together when the serum is added, the person is Rh positive; if not, the person is Rh negative.

Fun fact: Everyone knows that people with O Rh- blood are universal donors, but there are also universal receivers—they have the AB Rh+ blood type. The opposite is true for plasma donors. O plasma contains antibodies for both A and B, so it would cause an immune reaction in any other blood type. AB plasma doesn’t have either antibody, so it’s universal.