Made update and draw thread safe