adding routing logic and fixing routing layer hiding when selecting new route