Separating repaint and game loop.