Some background: I wanted to replace a light fixture but I wanted it to be lower than the previous one so I had to move the wires but when I cut away the wall I saw there was a lot more going on than the wire for the previous light fixture. There are 4 sets of wires going into this box from the back plus another grey one (lower right in picture) that is now disconnected since the wire nuts came apart when I started moving it.
Here's a picture
I tried to draw a color line to help differentiate the wires.
The wire coming in from the upper left is from the light switch. As you can see the black wire is by itself and just goes to the light fixture. However the white wire goes to where all the other black wires are spliced together. The white wire from the light fixture itself goes to where all the other white wires are spliced together. I opened my light switch plate and the switch has a white wire and black wire connected to it (sorry I forgot to take a picture behind the switch before I put it back together).
The house is at least 50 years old so it isn't too surprising that the wiring is a bit weird.
Why is it this way and not the way this guy does it https://www.youtube.com/watch?v=LSyzLNUoGus
Also, what's the best way to put this back together so it's safe?
**For what it's worth, there was tape wrapped around the splice on the left side of the green line but no cap.