looks like you connected jb correct but i would advise that you use a 20amp 4 pin jb not 3 pin (this will eliminate the need for the extra connector).
the 4 core is for your fan.
remember if you are putting recessed spot lights in a bathroom they have to be the correct IP rated for the...