Improve drawing algorithm.