Refactored join drawing.

This should reduce the computational complexity from O(V*E^2) to O(V*E),
where V is the number of vertices and E is the number of edges.