Modified code using memory draw.