The skin contains layers that protect the internal parts of the body. The epidermis is the outer layer of the skin that contains cells called kertinocyte that pact together so that no bacteria can pass through the deeper layer of the skin. Aside from this protective barrier, the skin also has Langerhan cells that are part of the immune system. These cells signal the immune system to release white blood cells to protect invading harmful bacteria and other forms of infection. This is the reason why every time you scratch your skin it turns red and becomes swollen.