refactoring and drawing lines on the map