better wire drawing algorithm