Added sorting of segments before adding blank segments in Routes.js