improved performance and added algorithmus to connect ways