I think skimask is correct.
I will also add the two wires coming out of the end are for speed feed back, a tach of sorts. These normally go to the speed controller. Say you have a conveyor with a variable load. Those two wires is how the controller knows what speed things are running at.