Interference problem with slotted IR sensors

Success!!! The extra 2 ceramic capacitors soldered to the motor body seems to have made a massive difference. I'll have to test it further, but it seems to have solved the problem! When I finally route the cables in the chasis, is the idea to keep the sensor & motor cables as short as possible? I've also read to route the sensor wires away from the power lines, but to do that I'd need longer cables. So my question is, which is most important?

Thanks a lot to everyone who has helped with this.

Michael