Adapted algorithm for drawing. Produced unexpected result, will fix