Fix railroad-split bug when clicking outside the railroad limits.
Some cleanup at end of main.