changed drawing to a begin/end block