added polyline drawing and re-org of code