double buffer prevents flickering