Wiring – Decipher electrical junction

wiring

I am replacing an light fixture and box. The box is not actually a box, it's a round thing with 4 round tubular portals. The electricians have treated this thing as a junction box so it has a lot of wires I want to decipher the purpose of. There are two lines of Greenfield going into the box and two lines of Romex going into it. In the diagram below I have labeled the Greenfield lines A and B, and the Romex lines X and Y.

enter image description here

My plan is to add a junction box and have the connections in the box. Then add a second box for the light to which only two wires will go (doh).

Should I keep this same wiring scheme or change it?

Best Answer

I do believe this is a switch loop with the supply going to the box. I think Xb, Yb, A2, B2 is the hot supply leg and going to additional lighting or some outlets. Xw, A1 B1 and to the light is the neutral. Yw is the return from the switch (romex Y caries hot to the switch and the white returns the hot to the light when turned on. If this matches what you have the light fixture is wired backwards and the Yw wire should be marked with tape, marker or paint (I like red for a switched leg but black is normal).