Make road connection code more readable

Hopefully without introducing exciting new bugs.